<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>相对定位</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        [class^=box] {
            width: 200px;
            height: 200px;
        }

        .box1 {
            background-color: #bfa;
            opacity: .8;
        }

        .box2 {
            background-color: tomato;
            position: relative;
            top: -50px;
            left: 50px;
            z-index: -1;
            opacity: .5;
        }

        .box3 {
            background-color: orange;
            opacity: .4;
        }
    </style>
</head>

<body>
    <!-- 相对定位: 不脱离文档流, 根据元素在文档流中本身的位置计算偏移量, 提升元素层级 -->
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
</body>

</html>